﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Windvoice.Blog.DataAccess;
using System.Data;

namespace Windvoice.Web
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ArticleDAL dal = new ArticleDAL();
            CommentDAL comment = new CommentDAL();
            Response.Write(EchoDataTable(comment.Comment_GetList()));
            //Response.Write(dal.Articke_Get(1).IsHidden==false?"aa":"bb");
        }

        public static string EchoDataTable(DataTable dt)
        {
            string returnString = "";
            int i = 0, j = 0;
            returnString += "<table><tr>";
            returnString += "<th>序号</th>";
            for (i = 0; i < dt.Columns.Count; i++)
            {
                returnString += "<th>" + dt.Columns[i].Caption + "</th>";
            }
            returnString += "</tr>";
            for (i = 0; i < dt.Rows.Count; i++)
            {
                returnString += "<tr>";
                returnString += "<td>第" + i.ToString() + "行</td>";
                for (j = 0; j < dt.Rows[i].ItemArray.Length; j++)
                {
                    //if (j == 1) Response.Write("<td>" + GetCfName(dt.Rows[i].ItemArray[1].ToString()) + "</td>");
                    //else Response.Write("<td>" + dt.Rows[i].ItemArray[j] + "</td>");
                    returnString += "<td>" + dt.Rows[i].ItemArray[j] + "</td>";
                }
                returnString += "</tr>";
            }
            returnString += "</table>";
            return returnString;
        }
    }
}
